﻿@model LeEdu.MODEL.Group
@using LeEdu.MODEL;
@{
    ViewBag.Title = "GroupHomepage";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<div id="content-container" class="container">
    <div class="group-header">
        <div class="group-header-inner" style="background: url(http://localhost:5130/Img/@Model.GBACKGROUND); background-repeat: no-repeat; background-size: 100% 100%; ">
            <div class="media">
                <div class="media-left">
                    <a href="/Group/GroupHomepage/@Model.GroupID">
                        <img src="http://localhost:5130/Img/@Model.GLOGO" alt="@Model.GNAME" class="avatar-square-sm">
                    </a>
                </div>
                <div class="media-body">
                    <h2 class="media-heading">@Model.GNAME</h2>
                    <div class="media-metas">
                        @ViewBag.Count 个成员
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-8 group-main">

            <div class="panel panel-default">
                <div class="panel-body">
                    <ol class="breadcrumb">
                        <li><a href="/Group/GroupAll">小组频道</a></li>
                        <li class="active">@Model.GNAME</li>
                    </ol>
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="/Group/GroupHomepage/@Model.GroupID">小组首页</a></li>
                        <li><a href="/Group/TeamMember/@Model.GroupID">小组成员</a></li>
                        <li><a href="/Group/GroupSetting/@Model.GroupID">小组设置</a></li>   
                       <li><a href="/Group/HuaTiCreate/@Model.GroupID" target="blank">发表话题</a></li>
                    </ul>

                    <div class="alert alert-info ">
                        <div class="clearfix">
                            @Html.Raw(Model.GINTROGUCE)
                        </div>
                        <hr>
                        <div class="">

                            <span class="text-muted fsn mrm">创建时间：@Model.GSTATTIME.ToString("yyyy-MM-dd")</span>
                            <span class="text-muted fsn mrm">
                                组长：
                                <a class="link-light link-muted " href="#">
                                    @*@((ViewBag.ZU as LeEdu.MODEL.UserAndGroup).Users.Uname)*@
                                </a>
                            </span>
                            @if (Session["User"] != null)
                            {
                                if (Convert.ToInt32(ViewBag.Ren) < 1)
                                {
                                    <a id="add-btn" class="btn btn-info btn-sm pull-right" href="/Group/Jia/@Model.GroupID">加入小组</a>
                                }
                                else
                                {
                                    <span class="text-muted fsn ">
                                        你已经是小组成员，
                                        <a id="exit-btn" class="text-muted" href="/Group/Tui/@Model.GroupID"> » 退出小组</a>
                                    </span>
                                }
                            }
                            else
                            {
                                <a id="add-btn" class="btn btn-info btn-sm pull-right" href="/Group/Jia/@Model.GroupID">加入小组</a>
                            }
                        </div>
                    </div>

                    <div class="nav-filter clearfix mbl">
                            <ul class="nav nav-pills nav-pills-sm">
                                <li class="active"><a class="js-nav" data-target="#thread-pane">全部</a></li>

                                <li><a class="js-nav" data-target="#thread-pane" href="">精华</a></li>

                                <li class="dropdown">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                        <span class="text-muted">排序：</span>
                                        最新发帖
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                                        <li class="active"><a class="js-nav" href="#">最新发帖</a></li>
                                        <li class=""><a class="js-nav" href="#">最后回复</a></li>
                                        <li class=""><a class="js-nav" href="#">回复数</a></li>
                                    </ul>
                                </li>
                            </ul>
                         @if (Session["User"] != null)
                         {

                             @*if ((ViewBag.ZU as LeEdu.MODEL.UserAndGroup).UserInfoID == (Session["User"] as LeEdu.MODEL.UserInfo).UserInfoId)
                             {
                            <div class="pull-right">
                            <a href="/Group/HuaTiCreate/@Model.GroupID" class="btn btn-primary btn-sm" role="button">发话题</a>
                        </div>
                             }*@
                         }
                        
                    </div>
                    <ul class="media-list thread-list"  id="QUAN">
                        @if (ViewBag.HUA != null)
                        {                         
                                                       
                            foreach (var item in ViewBag.HUA as List<LeEdu.MODEL.Topicshi>)
                            {
                                <li class="media">
                                    <a class="pull-left js-user-card" href="" data-card-url="/user/4/card/show" data-user-id="4">
                                        <img class="avatar-md" src="http://localhost:5130/Img/@item.Users.Avatar">
                                    </a>

                                    <div class="media-body">
                                        <div class="media-heading">
                                            @if (item.TATTRIBUTE != null && item.TATTRIBUTE.Contains("置顶"))
                                            {
                                                <span class="label label-danger">置顶</span>
                                            }
                                            <a class="title" href="/Group/SreachTopic/@item.ID">@item.TTITLE</a>
                                            @if (item.TATTRIBUTE != null && item.TATTRIBUTE.Contains("加精"))
                                            {
                                                <span class="label label-warning">精</span>
                                            }
                                        </div>

                                        <div class="metas">
                                            <a class="link-light link-muted" href="#">@item.Users.Uname</a>

                                            <span class="divider">•</span>
                                            @((DateTime.Now - item.TSTARTTIME).Minutes) 分钟前
                                            
                                        </div>
                                    </div>
                                </li>
                            }

                        }
                        else
                        {
                            <li class="empty">暂无话题！</li>
                        }

                    </ul>
                                    </div>
            </div>
        </div>
        <div class="col-md-4 group-side">
            <form class="mbl" action="/Group/GroupSearchTopic" method="post">
                <div class="input-group group-search">
                    <input name="_csrf_token" value="979cf88c2ccb366c624d6a2a74bc7493d5abacd7" type="hidden">
                    <input id="Hidden1" type="hidden" name="id" value="@Model.GroupID" />
                    <input class="form-control" placeholder="组内搜索" name="TTITLE" type="text">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
                    </span>
                </div>
            </form>
            <div class="panel panel-default">
                <div class="panel-heading">我在小组</div>
                <div class="panel-body">
                    <div class="media group-item">
                        <div class="media-left">
                            @if (ViewBag.ZU != null)
                            {
                                <a class=" js-user-card" href="/user/4" data-card-url="/user/4/card/show" data-user-id="4">
                                    @*<img class="avatar-sm" src="@Url.Content("~/Img/@((ViewBag.ZU as LeEdu.MODEL.UserAndGroup).Users.Avatar)")" />*@
                                    <img class="avatar-sm" src="~/Img/@((ViewBag.ZU as LeEdu.MODEL.UserAndGroup).Users.Avatar)" />
                                </a>
                            }
                            else
                            {
                                <a class=" js-user-card" href="/user/4" data-card-url="/user/4/card/show" data-user-id="4">
                                    <img class="avatar-sm" src="@Url.Content("~/Content/img/user.png")" />
                                </a>
                            }

                        </div>
                        <div class="media-body">
                            <p>
                                <a class="link-light link-muted" href="#">@((ViewBag.ZU as LeEdu.MODEL.UserAndGroup).Users.Uname)</a>



                                <span class="label label-info">组长</span>


                            </p>
                            <p class="text-muted fsn">
                                <span class="mrm">我的话题: @ViewBag.HCount</span>
                                <span>我的回复: 0</span>
                            </p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">最近加入</div>
                <div class="panel-body">
                    <ul class="user-avatar-list clearfix">
                        @foreach (var item in ViewBag.ZUI as List<LeEdu.MODEL.UserAndGroup>)
                        {
                            <li>
                               @if (item.Users.Avatar != null)
                               {
                                    <a class=" js-user-card" href="#" data-card-url="/user/4/card/show" data-user-id="4">
                                        @*<img class="avatar-sm" src="@Url.Content("~/Img/@item.Users.Avatar")" />*@
                                        <img class="avatar-sm" src="~/Img/@item.Users.Avatar" />
                                    </a>
                               }
                               else
                               {
                                    <a class=" js-user-card" href="#" data-card-url="/user/4/card/show" data-user-id="4">
                                        <img class="avatar-sm" src="@Url.Content("~/Content/img/user.png")" />
                                    </a>
                               } 

                                <div class="name">
                                    <a class="link-light " href="#">@item.Users.Uname</a>

                                </div>
                            </li>
                        }

                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
